<template>
  <div :style="{ display: 'flex' }" id="infoCard">
    <a-card :style="{ width: '360px' }" title="User Info">
      用户姓名： {{ userName }}<br /><br />
      您的身份: {{ identity }} <br /><br />
      加入的班级: {{ classAdd }} <br /><br />
    </a-card>
  </div>
</template>

  <script>
import axios from "axios";


export default {
  data() {
    return {
      userName: this.$store.state.user.loginUser.userName,
      identity: this.$store.state.user.loginUser.userIdentity,
      classAdd: "",
    };
  },
  mounted() {
    axios
      .post("/class", {
        classId: this.$store.state.user.loginUser.classId,
      })
      .then((response) => {
        if (response.data.classId == 1000) {
          this.classAdd = "未加入班级";
        } else {
          this.classAdd = response.data.className;
        }
      })
      .catch(function (error) {
        console.log(error);
      });
  },
};
</script>
  
<style >
#infoCard {
  margin-top: 200px;
  justify-content: center;
}
</style>